jQuery(document).ready(function($){
    $('.use-ajax input.input-submit').click(function(e){
		
        $('.error').hide('');
        var form=$('form.use-ajax');
        
        if($(form).hasClass('use-ajax')){
            $.ajax({
                type: 'POST',
                url:$(form).attr('action'),
                data:$(form).serialize(),
                success:function(data){
                    var output=eval('('+data+')');
                    if(output.status=='succeed'){
                        window.location=output.message;
                    }else{
                        $('.error').html(output.message);
                        $('.error').show('slow');
                    }
                }
            });
        }else{
            alert('ERROR::Your form is not initialization as ajax form!!')
        }
        e.preventDefault();
    });
})
